<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="baseurl" value="${pageContext.request.contextPath}/"></c:set>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="<%=path%>/CSS/style.css" rel="stylesheet" type="text/css" />
    <!-- css资源 -->
    <link rel="stylesheet" type="text/css" href="${baseurl}easyUI1.4.1/themes/default/easyui.css">
    <!-- 图标资源 -->
    <link rel="stylesheet" type="text/css" href="${baseurl}easyUI1.4.1/themes/icon.css">
    <script type="text/javascript" src="<%=path%>/easyUI1.4.1/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="${baseurl}easyUI1.4.1/jquery.easyui.min.js"></script>
    <!-- 本地语言 -->
    <script type="text/javascript" src="${baseurl}easyUI1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <style type="text/css">
        .head{margin: 20px 45px;background: #fff;min-height: 530px;box-shadow: 0 0 5px #cccccc;border-radius: 5px;}
        .head-detail{width: 250px;float: left;height: 120px;margin: 30px 30px;margin-bottom: 0px}
        .box img{cursor:pointer;float: left;height: 120px;width: 250px}
        .head-content{float: left;margin-right: 100px}
        .bottom {float: left;height: 80px;width: 100%;margin-left: 40px;line-height: 80px;font-size: 16px}
        .bottom span{font-size: 14px}
        .bottom a{color: #57a0ff;padding-left: 20px;cursor: pointer;font-size: 14px}
        .head-detail:hover{-moz-transform: translate(0px, -15px);
            -webkit-transform: translate(0px, -15px);
            -ms-transform:translate(0px, -15px);
            -webkit-transition: all 0.7s linear;
            -moz-transition: all 0.7s linear;
            -o-transition: all 0.7s linear;
            -ms-transition: all 0.7s linear;
            transition: all 0.7s linear;}
        .admin{width: 300px; height: 45px;line-height: 45px;color: #99bdec;padding-right: 40px;float: right;}
        .admin a{cursor: pointer;color: #99bdec;}
        .group{width: 315px; height: 40px;line-height: 40px;color: #444444;padding-left: 15px;float: left;}
        .admin-bottom{position: fixed;bottom: 0;background: #3c4351;width: 100%;z-index: 99;}
        .message-box {
            position:fixed;
            width:300px;
            height:185px;
            line-height:60px;
            box-shadow:1px 2px 3px #cccccc;
            border:1px solid #cccccc;
            border-radius:4px;
            text-align:center;
            color:#cccccc;
            z-index: 101;
            float: right;
            bottom:55px;
            right:200px;
            /*     margin-right: 108px; */
            display: none;
        }
        .triangle-border {
            position:absolute;
            left:30px;
            overflow:hidden;
            width:0;
            height:0;
            border-width:10px;
            border-style:solid dashed dashed dashed;
            z-index: 101;
        }
        .tb-border {
            bottom:-20px;
            border-color:#cccccc transparent transparent transparent;
        }
        .tb-background {
            bottom:-19px;
            border-color:#fff transparent transparent transparent;
        }
        .title{height: 40px;background: #f2f2f2;}
        .title-next{float: left;color: #444444;padding-left: 15px;width: 285px;height: 144px;text-align: left;background: #fff}
        .title-next span{float: left;color: #444444;width: 285px;height: 25px;display: inline;}
        .del{display: inline;float: right;padding-right: 50px;font-size: 18px;color: #444444;}
        .title-next li{height: 25px;margin-top: -15px;font-size: 13px}

        .icon-ok{padding-left: 10px;}
        .l-btn-text{padding-left: 10px;}
        .border-red{border:1px solid #EF0433;}

        .td_r{text-align: left;color: #626262;font-size: 14px;padding-left: 15px;border: 1px solid #efeff4;border-right: none;}
        .td_l{border: 1px solid #efeff4;border-left: none;}
        input[type=Password] {float: left;zoom:1;outline: medium;font-size: 14px;width:95%;background-color: #f2f2f2}

    </style>
</head>

<body style="background: #e9e9e9">
<div class="head" >
    <div class="head-content">
        <c:forEach var="indexMenu" items="${indexMenu}" varStatus="status">
        <c:choose>
        <c:when test="${status.count == 1}">
        <ul>
            <li>
                <div class="head-detail">
                    <div class="box">
                        <img  src="${indexMenu.imgUrl}"onclick="inIndexMenu('${indexMenu.menuUrl}')">
                    </div>
                </div>
                </c:when>
                <c:when test="${fn:length(list) == status.count }">
                <div class="head-detail">
                    <div class="box">
                        <img  src="${indexMenu.imgUrl}"onclick="inIndexMenu('${indexMenu.menuUrl}')">
                    </div>
                </div>
            </li>
        </ul>
        </c:when>
        <c:when test="${status.count % 3 == 0}">
        <div class="head-detail">
            <div class="box">
                <img  src="${indexMenu.imgUrl}"onclick="inIndexMenu('${indexMenu.menuUrl}')">
            </div>
        </div>
        </li>
        <li>
            </c:when>
            <c:otherwise>
            <div class="head-detail">
                <div class="box">
                    <img  src="${indexMenu.imgUrl}"onclick="inIndexMenu('${indexMenu.menuUrl}')">

                </div>
            </div>

            </c:otherwise>
            </c:choose>

            </c:forEach>

    </div>

    <div class="bottom">
        <ul>
            <li>
	            <span>最近访问：
	            <c:forEach items="${oftenMenu}" var="oftenMenu" varStatus="status">
                    <a style="padding-left: 5px" href="<%=path %>/DrivingSys${oftenMenu.menuUrl}">${oftenMenu.menuName}</a>
                </c:forEach>
	            </span>
            </li>
        </ul>
    </div>
</div>

<%--	<div class="message-box">
	 <div class="title">
		 <div class="group" >
		    <ul>
		    	<li style="text-align: left;height: 40px;font-size: 12px;">
		    		<img width="11px" height="11px"  src="<%=path%>/images/index/qhzz.png" >&nbsp;
		    		切换组织
		    		<span class="del">×</span>
		    		<span class="del"Onclick="ajaxJSP_searchCompany()()">更多</span>
		    	</li>
		    </ul>
	     </div>
	 </div>
	 <div class="title-next">
		 <ul style="height: 142px;">
		 	 <c:forEach items="${indexOrg}" var="indexOrg" varStatus="status">
            		<li onclick="setCompany('${indexOrg.fid}','${indexOrg.companyName}','${indexOrg.flongnumber}')">
					     <span >${indexOrg.companyName}</span>
					 </li>
            </c:forEach>
		 </ul>
	 </div>

	  <div class="triangle-border tb-border"></div>
	  <div class="triangle-border tb-background"></div>
	</div>--%>

<div id="company_window_div" class="easyui-window user_set_windows" title="选择公司"
     data-options="modal:true,closed:true,collapsible:false,minimizable:false,
			maximizable:false,iconCls:'icon-save',top:120
            ,onClose: function () {document.body.style.overflow = 'visible';}" style="width:500px;height:265px;display:none">
    <div style="height:262px;width:488px">
        <table id="company_list_table"toolbar="#company_bar">
        </table>
        <div id="company_bar"style="background-color: #f5f5f5;padding:5px 10px">
            <label style="margin:5px 5px 0 10px ;font-size:14px;float:left">公司名称：</label>
            <input type="text"class="easyui-validatebox"  placeholder="请输入公司名称" id="company_name_input"
                   style="width:150px;height:27px;margin-right:20px;"/>
            <input type="button"value="立即搜索" onclick="CompanyPage()"
                   style="cursor:pointer;background-color: #54a0ff;color: #fff;border-radius:20px;padding:5px 20px"/>
        </div>
    </div>
</div>
<%--<div class="loading"  style="text-align: center;padding-top: 10%;">
    <img style="text-align: center" src="<%=path%>/images/index/loading.gif" width="20%" >
</div>--%>
</body>
<script type="text/javascript">
    /*window.onload = function() {
       var flag = <%=session.getAttribute("loadingFlag")%>
          if(flag == 1 ){
              $(".loading").fadeToggle()
              $(".head").fadeToggle()
          }else{
              setTimeout(function(){
                  $(".loading").fadeOut()
                  $(".head").fadeIn() }, 500)
		  }
      };*/
    //IE不支持console对象，此代码仅为测试使用
    ///////////////////////////////////////
    window.console = window.console || (function () {
        var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
            = c.clear = c.exception = c.trace = c.assert = function () { };
        return c;
    })();
    var right_company_flag = false;
    //设置 session中的公司信息
    /* function setCompany(companyID,companyName){
    	$.ajax({
		      url:'${baseurl}right/setCompany.action',
		      type: "post",
		      dataType:"json",
		      data:{"companyID":companyID,"companyName":companyName},
		      success: function(json) {
		    	  if(json.success == undefined ||json.success == 'undefined' ){
			        	$.messager.alert('提示','设置组织失败','warning');
		          }else{
		    	  	$("#bottom_Company_a_id").text(companyName);
		    	  	$('.message-box').hide();
		          }
		      },
		      error: function(){
		    	  $.messager.alert('提示','请刷新页面重试','warning');
		      }
    	});

    } */
    //跳转
    function inIndexMenu(url){
        console.log("${baseurl}DrivingSys" + url)
        window.parent.frames["rightFrame"].location.href = "${baseurl}DrivingSys" + url;
    }
    $('.admin-detail').live('click',function(){
        $('.message-box').toggle();
    });
    //打开公司搜索窗口
    function ajaxJSP_searchCompany(){
        //清除用户checked项
        //$('#company_list_table').datagrid('clearSelections');
        $("#company_window_div").attr("style","width:500px;height:265px;");
        $('#company_window_div').window('open');
        $('#company_window_div').window('center');
        CompanyPage();
    }
    //公司分页查询
    function CompanyPage(){
        $('.loading').hide();
        if(right_company_flag){
            var patrn=/[!#@$%^&*()_+<>?:"{},\/;'[\]]/;
            if(patrn.test($('#company_name_input').val())){
                $.messager.alert('提示','请不要使用非中文符号!');
                return true;
            }
            //保留页码查询
            $('#company_list_table').datagrid('reload',{
                company: $('#company_name_input').val()
            });
        }else{
            $("#company_list_table").datagrid({
                url:'${baseurl}DrivingSys/common/company.action',  //数据来源
                //冻结列
                columns:[[
                    {field: 'ck', checkbox: true, width: 30 },  //复选框
                    {field:'companyName',title:'公司名称',width:420,align:'center'}
                ]],
                fitColumns:false,//自适应宽度，占满,不能和冻结列同时设置成true
                fit:true,//充满屏幕
                striped:true,   //斑马线效果
                rownumbers:true,            //显示行号
                idField:'fid',    //主键列
                singleSelect:true,          //是否单选
                cache:true,				//关闭缓存
                method:'post',
                pagination:true,
                pageList:[10,20,50,100],//每页行数选择列表
                pageSize:20, //设置默认初始的每页行数rows
                pageNumber:1,//设置默认初始的页码page
                multiSort:true,
                onClickRow : function(index, row){
                    $.messager.confirm('提示', '是否为将组织设置为<b>'+row.companyName+'</b>?', function (r) {
                        if (!r) {
                            return;
                        }
                        var selRow = $('#company_list_table').datagrid('getSelections')[0];
                        //底部公司设置
                        window.parent.parent.frames['bottomFrame'].setCompany(row.fid,row.companyName,row.flongnumber);

                        //重置顶部个人消息。
                        window.parent.parent.frames['topFrame'].top_setMessage_Flag();

                        $('#company_window_div').window('close');
                    });
                },
                onLoadSuccess:function(){
                    right_company_flag = true;
                    $('#company_list_table').datagrid('clearSelections');
                    document.body.style.overflow = "hidden"; //隐藏滚动条
                },loadMsg:'请稍候...'

            });
        }
    }

    $('.del').live('click',function(){
        $('.message-box').hide();
    })
    function openPwd(){

    }



    //启用停用滚动条
    function openOrCloseOverflow(flag) {
        if(flag)
        {
            document.body.style.overflow = "hidden"; //隐藏滚动条
        }else{
            document.body.style.overflow = "visible"; //显示滚动条
        }
    }
</script>
</html>